/*
 * Copyright (c) 2008-2013 Haulmont. All rights reserved.
 * Use is subject to license terms, see http://www.cuba-platform.com/license for details.
 */

package com.haulmont.asu.entity;

import com.haulmont.chile.core.annotations.NamePattern;
import com.haulmont.cuba.core.entity.StandardEntity;
import com.haulmont.cuba.security.entity.User;

import javax.persistence.*;
import java.util.Date;
import java.util.List;

/**
 * Author: Sergey42
 * Date: 17.10.13 13:58
 */
@Table(name = "ASU_PROJECT")
@Entity(name = "asu$Project")
@NamePattern("%s|name")
public class Project extends StandardEntity {

    private static final long serialVersionUID = 8780619806766189592L;

    @Column(name = "NAME", length = 50)
    protected String name;

    @Column(name = "START_DATE")
    @Temporal(TemporalType.DATE)
    protected Date startDate;

    @OneToMany(mappedBy = "project")
    protected List<Work> works;

    @OneToMany(mappedBy = "project")
    protected List<Phase> phases;

    @OneToMany(mappedBy = "project")
    protected List<Stage> stages;

    @OneToMany(mappedBy = "project")
    protected List<Step> steps;

    @ManyToOne
    @JoinColumn(name = "PROJECT_ENGINEER_ID")
    protected User projectEngineer;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Date getStartDate() {
        return startDate;
    }

    public void setStartDate(Date startDate) {
        this.startDate = startDate;
    }

    public List<Work> getWorks() {
        return works;
    }

    public void setWorks(List<Work> works) {
        this.works = works;
    }

    public User getProjectEngineer() {
        return projectEngineer;
    }

    public void setProjectEngineer(User projectEngineer) {
        this.projectEngineer = projectEngineer;
    }

    public List<Phase> getPhases() {
        return phases;
    }

    public void setPhases(List<Phase> phases) {
        this.phases = phases;
    }

    public List<Stage> getStages() {
        return stages;
    }

    public void setStages(List<Stage> stages) {
        this.stages = stages;
    }

    public List<Step> getSteps() {
        return steps;
    }

    public void setSteps(List<Step> steps) {
        this.steps = steps;
    }
}
